<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>

//  去重
const arr = [1,1,2,2]
const arr2 = [...new Set(arr)]

//  判断元素是否在集合中
const set = new Set(arr)
const has = set.has(3)

//  求交集
const set2 = new Set([2,3])
const set3 = new Set([...set].filter(item => set2.has(item)))

    </script>
</body>
</html>